<?php

include "../vendor/autoload.php";

/*
 * 判断字符串是否为json
 */
var_export(\Tools\StringTool::isJsonStrict("{}"));


/*
 * 获取上级为2的所有子集
 */
$list = [
    ['id' => 1, 'pid' => 0, 'name' => 'aaa'],
    ['id' => 2, 'pid' => 0, 'name' => 'aaa'],
    ['id' => 3, 'pid' => 1, 'name' => 'aaa'],
    ['id' => 4, 'pid' => 1, 'name' => 'aaa'],
    ['id' => 5, 'pid' => 2, 'name' => 'aaa'],
    ['id' => 6, 'pid' => 2, 'name' => 'aaa'],
    ['id' => 7, 'pid' => 3, 'name' => 'aaa'],
    ['id' => 8, 'pid' => 4, 'name' => 'aaa'],
    ['id' => 9, 'pid' => 5, 'name' => 'aaa'],
    ['id' => 10, 'pid' => 6, 'name' => 'aaa'],
];
var_export(\Tools\ArrayTool::arrayFindChild($list,2));